package edu.ccut.titan.tag.report.servlet;

import java.awt.Point;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class PageSize {
	
	public static final Point LETTER = new Point(612, 792);

	/** This is the note format */
	public static final Point NOTE = new Point(540, 720);

	/** This is the legal format */
	public static final Point LEGAL = new Point(612, 1008);

	/** This is the a0 format */
	public static final Point A0 = new Point(2380, 3368);

	/** This is the a1 format */
	public static final Point A1 = new Point(1684, 2380);

	/** This is the a2 format */
	public static final Point A2 = new Point(1190, 1684);

	/** This is the a3 format */
	public static final Point A3 = new Point(842, 1190);

	/** This is the a4 format */
	public static final Point A4 = new Point(595, 842);

	/** This is the a5 format */
	public static final Point A5 = new Point(421, 595);

	/** This is the a6 format */
	public static final Point A6 = new Point(297, 421);

	/** This is the a7 format */
	public static final Point A7 = new Point(210, 297);

	/** This is the a8 format */
	public static final Point A8 = new Point(148, 210);

	/** This is the a9 format */
	public static final Point A9 = new Point(105, 148);

	/** This is the a10 format */
	public static final Point A10 = new Point(74, 105);

	/** This is the b0 format */
	public static final Point B0 = new Point(2836, 4008);

	/** This is the b1 format */
	public static final Point B1 = new Point(2004, 2836);

	/** This is the b2 format */
	public static final Point B2 = new Point(1418, 2004);

	/** This is the b3 format */
	public static final Point B3 = new Point(1002, 1418);

	/** This is the b4 format */
	public static final Point B4 = new Point(709, 1002);

	/** This is the b5 format */
	public static final Point B5 = new Point(501, 709);

	/** This is the archE format */
	public static final Point ARCH_E = new Point(2592, 3456);

	/** This is the archD format */
	public static final Point ARCH_D = new Point(1728, 2592);

	/** This is the archC format */
	public static final Point ARCH_C = new Point(1296, 1728);

	/** This is the archB format */
	public static final Point ARCH_B = new Point(864, 1296);

	/** This is the archA format */
	public static final Point ARCH_A = new Point(648, 864);

	/** This is the flsa format */
	public static final Point FLSA = new Point(612, 936);

	/** This is the flse format */
	public static final Point FLSE = new Point(612, 936);

	/** This is the halfletter format */
	public static final Point HALFLETTER = new Point(396, 612);

	/** This is the 11x17 format */
	public static final Point _11X17 = new Point(792, 1224);

	/** This is the ledger format */
	public static final Point LEDGER = new Point(1224, 792);

	private Map<String, Point> pageSizes;
	
	private static PageSize instance = new PageSize();
	
	public static PageSize getInstance() {
		return instance;
	}
	
	private PageSize(){
		pageSizes = new TreeMap<String, Point>();
		
		pageSizes.put("A0", A0);
		pageSizes.put("A1", A1);
		pageSizes.put("A2", A2);
		pageSizes.put("A3", A3);
		pageSizes.put("A4", A4);
		pageSizes.put("A5", A5);
		pageSizes.put("A6", A6);
		pageSizes.put("A7", A7);
		pageSizes.put("A8", A8);
		pageSizes.put("A9", A9);
		pageSizes.put("A10", A10);
		pageSizes.put("B0", B0);
		pageSizes.put("B1", B1);
		pageSizes.put("B2", B2);
		pageSizes.put("B3", B3);
		pageSizes.put("B4", B4);
		pageSizes.put("B5", B5);
		pageSizes.put("ARCHE_E", ARCH_E);
		pageSizes.put("ARCHE_D", ARCH_D);
		pageSizes.put("ARCHE_C", ARCH_C);
		pageSizes.put("ARCHE_B", ARCH_B);
		pageSizes.put("ARCHE_A", ARCH_A);
		pageSizes.put("LETTER", LETTER);
		pageSizes.put("NOTE", NOTE);
		pageSizes.put("LEGAL", LEGAL);
		pageSizes.put("FLSA", FLSA);
		pageSizes.put("FLSE", FLSE);
		pageSizes.put("HALFLETTER", HALFLETTER);
		pageSizes.put("11x17", _11X17);
		pageSizes.put("LEDGER", LEDGER);
	}
	
	public Point getPageSize(String pageName) {
		return pageSizes.get(pageName);		
	}
	
	public Set<String> getPageSizeName(){
		return this.pageSizes.keySet();
	}
}
